function outcome_category = categorize_outcome(outcome, thresholds, labels)

% convert a vector of outcomes into categories (labels)
% inputs: outcome: a numerical vector
%         thresholds: a numerical 1x(N-1) row vector
%         labels: a 1xNcell, labels

% output: outcome_category: the same size of 'outcome', a cell, with 
%          corresponding label for each element

outcome_category = cell(size(outcome));

thresholds = [min(outcome), thresholds, max(outcome)];

num_lab = length(labels);
for idx = 1:num_lab
    outcome_category((outcome>thresholds(idx)) & (outcome<=thresholds(idx+1))) = labels(idx);
end